<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .box {
            height: 300px;
            width: 500px;
            border: 10px solid black;
            background-color: red;
            margin: 0 auto;
        }
    </style>
</head>
<body>
    
    <div class="box"></div>

<script>
    let box = document.querySelector(".box")
    
    console.log(box.offsetTop)
    console.log(box.offsetLeft)



</script>
</body>
</html>